'use strict';

angular.module('app')
    .controller('authImportLogDetailsController', ['$scope', '$rootScope', '$state', '$timeout', 'toaster',
        function($scope, $rootScope, $state, $timeout, toaster) {
            var title = "导入记录详情";
            $scope.projectId = localStorage.getItem('projectId');//根据项目id做一些页面字段的显示与隐藏，如果是projectId==2，就是学校项目，==1是其他
            var id = $state.params.id;
            activate(id);
            //将所有的input，select标签弄成不可编辑
            $("input").attr("disabled",true);
            $("select").attr("disabled",true);
            $scope.title = $rootScope.title = title;
            $scope.loading = true;

            $scope.selUser = function(){
                $scope.record.personId=$scope.record.person.split('_')[0];
                $scope.record.cardNo=$scope.record.person.split('_')[1];
            }

            function activate(id) {
                $scope.loading = true;
                $.ajax({
                    type: 'POST',
                    dataType: 'json',
                    contentType:'application/json;charset=UTF-8',
                    url : 'dac/authm/cardAuth/excelLog/Detail',
                    data: angular.toJson({'id': id})
                }).then(function(result) {
                    $scope.loading = false;
                    if (result.httpCode == 200) {
                        $scope.record = result.data;
                        console.log(result);
                    } else {
                        $scope.msg = result.msg;
                    }
                    $scope.$apply();
                });
            }

        }]);